package com.shiyi.design.factory.abstractfactory;

import com.shiyi.design.factory.abstractfactory.product.CPU;
import com.shiyi.design.factory.abstractfactory.product.GraphicsCard;

/**
 * @author wangzhanshuai
 * @date 2021-01-15 下午 10:14
 */
public class AbstractFactoryTest {

    public static void main(String[] args) {
        // 戴尔电脑生产线
        AbstractComputerFactory Factory1 = new DellComputerFactory();
        CPU cpu1 = Factory1.createCPU();
        GraphicsCard graphicsCard1 = Factory1.createGraphicsCard();
        System.out.println(cpu1.showName());
        System.out.println(graphicsCard1.showName());
        System.out.println("--------------------------------------------");
        // 惠普电脑生产线
        AbstractComputerFactory Factory2 = new HPComputerFactory();
        CPU cpu2 = Factory2.createCPU();
        GraphicsCard graphicsCard2 = Factory2.createGraphicsCard();
        System.out.println(cpu2.showName());
        System.out.println(graphicsCard2.showName());
    }
}
